package com.ericsson.enap.modules.cmdkpi.service.impl;

import com.ericsson.enap.modules.cmdkpi.entity.CmdKpiDict;
import com.ericsson.enap.modules.cmdkpi.mapper.CmdKpiMapper;
import com.ericsson.enap.modules.cmdkpi.service.CmdKpiService;
import com.ericsson.enap.modules.sys.entity.EnipNetelement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @description: 命令式kpi service 实现
 * @author: chenhongbo
 * @create: 2021-09-02 15:03
 */
@Component
public class CmdKpiServiceImpl implements CmdKpiService {
    @Autowired
    private CmdKpiMapper cmdKpiMapper;
    @Override
    public void initCmdKpiDict(List<CmdKpiDict> dictList) {
        for(int i=0; i<dictList.size(); i++) {
            CmdKpiDict dict = dictList.get(i);
            if(i == 0) {
                cmdKpiMapper.delete(dict);
            }
            cmdKpiMapper.insert(dict);
        }

    }

    @Override
    public List<CmdKpiDict> getCmdKpiDictList(CmdKpiDict dict) {
        return cmdKpiMapper.getCmdKpiDictList(dict);
    }

    @Override
    public List<EnipNetelement> getNetList(int type) {
        return cmdKpiMapper.getNetList(type);
    }
}
